package com.woniuxy04;

import java.util.Objects;

public class Student {
    int sid;
    String sname;
    int age;


    public Student() {
    }

    public Student(int sid, String sname, int age) {
        this.sid = sid;
        this.sname = sname;
        this.age = age;
    }

//    public boolean equals(Object obj) {
//        if(obj instanceof Student) {
//            Student other = (Student)obj;
//            return this.sid == other.sid
//                    && this.sname.equals(other.sname)
//                    && this.age == other.age;
//        }
//        return false;
//    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Student student)) return false;
        return sid == student.sid && age == student.age && Objects.equals(sname, student.sname);
    }

}
